package ndquangr.intern.ringtonemaker.listitems;

import java.util.ArrayList;

import ndquangr.intern.ringtonemaker.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class BrowseCateAdapter extends ArrayAdapter<String> {
	private ArrayList<String> items;
		
	public BrowseCateAdapter(Context context, int textViewResourceId, ArrayList<String> items) {
        super(context, textViewResourceId, items);
        this.items = items;    
	}
	   
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            if (v == null) {
                LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.browse_cate_item, null);
            }
            String o = items.get(position);
            if (o != null) {
                    TextView tv_item = (TextView) v.findViewById(R.id.tv_browse_cate_item); 
                    tv_item.setText(o);      
            }
            return v;
    }

}
